<template>
	<wxc-popup class="wxc-popup" popup-color="#f5f5f5" :show="isGoodsShow" @wxcPopupOverlayClicked="popupOverlayBottomClick" pos="bottom"
		height="520">

		<div class="popup-wrap">
			<div class="headWrap" v-if="isShowTit">
				<image :src="liveerInfo.shop_logo" class="liverAvatar"></image>
				<div>
					<text class="headWrapTitle">{{liveerInfo.shop_name}}</text>
					<text class="headWrapTitleSub">{{ liveerInfo.follow_num }}万人都粉它，关注它了解...</text>
				</div>
				<div class="headWrapRight">
					<text class="headGoShop"
						@click="linkTo('/pagesC/shop/storeDetails','shop_id',liveerInfo.shop_id)">进入店铺</text>
					<wxc-icon name="more" size="xs"></wxc-icon>
				</div>
			</div>
			<list class="goods-list">
				<cell class="cell-item" v-for="(item, index) in goodsList" :key="index">
					<div class="goods-list-box" @click="linkTo('/pagesC/goods/goodsDetails','id',item.id)">
						<image class="goods-avatar" :src="item.thumb_url"></image>
						<div class="goods-list__right">
							<text class="goods-title">{{ item.goods_name }}</text>
							<div class="moneyWrap">
								<text class="goodsMoneySymbol">¥</text>
								<text class="goodsMoneyPrice"> {{item.shop_price}}</text>
							</div>
						</div>
						<text class="goGrabBtn">{{ isAudienceRoom ? '马上抢' : '去看看'}}</text>
					</div>
				</cell>
				<text v-if="!goodsList.length" class="no-more">没有更多了</text>
			</list>

		</div>
	</wxc-popup>
</template>

<script>
	import {
		WxcIcon,
		WxcPopup
	} from 'weex-ui';

	export default {
		name: "liveGoodsList",
		props: {
			liveerInfo: {
				type: Object,
				default: () => {
					{}
				}
			},
			isShowTit: {
				type: Boolean,
				default: true
			},
			isAudienceRoom: {
				type: Boolean,
				default: true
			}
		},

		data() {
			return {
				isGoodsShow: false,
				goodsList: [],
			}
		},

		methods: {
			popupOverlayBottomClick() {
				this.isGoodsShow = false
			},
			/**
			 * @filepath pages/live/components/liveGoodsList.vue
			 * @param {type} typeid - 参数名
			 * @param {type} id - 参数值
			 * @description: nvue跳转
			 * @author: jayson
			 * @date: 17:26
			 */
			linkTo(path, typeid, id) {
				this.$emit("pPauseVideo")
				this.$emit("tuisong",id)
				uni.navigateTo({
					url: `${path}?${typeid}=${id}`,
				});
			},
		},
		components: {
			WxcPopup,
			WxcIcon
		}
	}
</script>

<style scoped>
	
	.popup-wrap {
		border-top-left-radius: 16upx;
		border-top-right-radius: 16upx;
		z-index: 9999999;
		width: 750upx;
		height: 1000upx;
	}

	.goods-list-box {
		flex-direction: row;
		align-items: center;
		padding-left: 20upx;
		padding-right: 20upx;
		padding-top: 20upx;
		padding-bottom: 20upx;
		justify-content: space-between;
		position: relative;
	}

	.goGrabBtn {
		position: absolute;
		bottom: 14upx;
		right: 30upx;
		background-image: linear-gradient(to bottom, #ffa468, #fa3f3f);
		color: #fff;
		padding: 12upx 30upx;
		border-radius: 200upx;
		font-weight: 600;
		font-size: 32upx;
	}

	.headWrap {
		flex-direction: row;
		padding: 15upx 30upx;
		align-items: center;
		background-color: #fff;
		justify-content: space-between;
	}

	.headWrapTitle {
		font-size: 30upx;
		font-weight: 600;
		color: #444;
	}

	.headWrapTitleSub {
		color: #999;
		margin-top: 8upx;
		font-weight: 500;
		font-size: 24upx;
	}

	.headGoShop {
		color: #999;
		font-size: 28upx;
	}

	.liverAvatar {
		width: 80upx;
		height: 80upx;
		margin-right: 10upx;
		background-color: #FFF;
		background-color: #f5f5f5;
		border-radius: 20upx;
	}

	.headWrapRight {
		flex-direction: row;
		align-items: center;
	}


	.goods-title {
		font-size: 30upx;
		margin-bottom: 18upx;
		text-overflow: ellipsis;
		lines: 2;

	}

	.goods-list__right {
		flex: 1;
		align-items: stretch;
		height: 172upx;
		justify-content: space-between;
	}

	.moneyWrap {
		flex-direction: row;
		align-items: flex-end;
	}

	.goodsMoneySymbol {
		font-size: 28upx;
		color: #fa3e3f;
		font-weight: 600;

	}

	.goodsMoneyPrice {
		font-size: 38upx;
		font-weight: 800;
		color: #fa3f3f;


	}

	.goods-list {
		width: 750upx;
	}

	.goods-avatar {
		width: 172upx;
		height: 172upx;
		margin-right: 12upx;
		border-radius: 10px;
		background-color: #f9f9f9;
	}
</style>
